package com.mm.mindmap.domain.po;


import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @BelongsProject: chatgpt-java-develop
 * @BelongsPackage: com.unfbx.model
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-04-08  19:37
 * @Version : 1.0
 * @ClassName : 思维导图类
 * @Description :
 */
@Data
@TableName("t_mindmap")
public class MindMap {
    //编号
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    //用户id
    private Long uid;
    //标题
    private String title;

    private String image;
    @TableField(value = "`like`")
    private Integer like;
    @TableField(value = "`view`")
    private Integer view;
    private Integer collect;
    //节点列表
    @TableField(value = "nodeList")
    private String nodeList;
    //状态,0:不置顶,1置顶
    @TableField(value = "isTop")
    private Byte isTop;
    //状态 0:私有 1:公开
    private Short state = 1;
    //创建时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField(value = "createTime")
    private Date createTime;
    //修改时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField(value = "updateTime")
    private Date updateTime;

    public void setAll(MindMap mindMap){
        if(mindMap.getId() != null){
            id = mindMap.getId();
        }
        if(mindMap.getUid() != null){
            uid = mindMap.getUid();
        }
        if(mindMap.getTitle() != null){
            title = mindMap.getTitle();
        }
        if(mindMap.getNodeList() != null){
            nodeList = mindMap.getNodeList();
        }
        if(mindMap.getCreateTime() != null){
            createTime = mindMap.getCreateTime();
        }
        if(mindMap.getUpdateTime() != null){
            updateTime = mindMap.getUpdateTime();
        }
    }

}
